import {createApp, Directive} from "vue";
import lazyPlugin from "vue3-lazy";
import naive from "naive-ui";
import router from "@/router";
import {createPinia} from "pinia";
import piniaPluginPersistedstate from "pinia-plugin-persistedstate";
import "lib-flexible";
import "virtual:svg-icons-register";
import VueViewer from "v-viewer";
import {VueDraggableNext} from 'vue-draggable-next'
import SvgIcon from "@/components/SvgIcon/index.vue";
import "@/permission";

import "nprogress/nprogress.css";
import "swiper/css";
import "swiper/css/autoplay";
import "swiper/css/mousewheel";
import "swiper/css/navigation";
import "swiper/css/pagination";
import 'swiper/css/scrollbar';

import {titleChange} from "@/utils/title";
import "@/assets/fonts/font.css";
import "@/assets/styles/index.scss";
import "animate.css";
import * as directive from "@/directive";
import App from "./App.vue";
// @ts-ignore
import error from "./assets/404_images/404.gif";
// @ts-ignore
import loading from "./assets/404_images/loading.gif";

const app = createApp(App);
Object.keys(directive).forEach((key) => {
    app.directive(key, (directive as { [key: string]: Directive })[key]);
});

const pinia = createPinia();
pinia.use(piniaPluginPersistedstate);
app.use(naive);
app.use(pinia);
app.use(router);
app.use(VueViewer);
app.use(lazyPlugin, {loading, error,});
app.component("svg-icon", SvgIcon);
app.component("draggable", VueDraggableNext);
app.mount("#app");
titleChange();
